package org.yaukie.startup.impl;

import javax.servlet.ServletContext;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.yaukie.ClassCacheFactory;
import org.yaukie.helper.ConfigHelper;
import org.yaukie.startup.inter.MyJobOnStartUpInitializer;

public class MyJobOnStartUpInitializerImpl implements MyJobOnStartUpInitializer {
    private static Logger logger = LoggerFactory.getLogger(MyJobOnStartUpInitializerImpl.class);

    public MyJobOnStartUpInitializerImpl() {
    }

    public void init(ServletContext servletContext) {
        if (logger.isDebugEnabled()) {
            logger.debug("MyJobOnStartUpInitializerImpl init starts ....");
        }

        if (ConfigHelper.isAutoOn()) {
            ClassCacheFactory.getMyJobInstance().startAllJob();
        } else if (logger.isDebugEnabled()) {
            logger.debug("定时任务暂未开启....");
        }

        if (logger.isDebugEnabled()) {
            logger.debug("MyJobOnStartUpInitializerImpl init ends ....");
        }

    }
}
